package com.fili.core.storage;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Claudiu-Florin FILIMON
 * Date: Oct 22, 2006
 * Time: 2:09:22 PM
 */
public class DataItemType
{
    public static final int TYPE_VALUE = 0;
    public static final int TYPE_BOOL = 1;

    private String name;
    private int type;
    public static int numValues = -1;
    public static Map<Index, DataItemType> names = null;


    public String getName()
    {
        return name;
    }

    public int getType()
    {
        return type;
    }

    public DataItemType(String name, int type)
    {
        this.name = name;
        this.type = type;
    }

    private static void setupStatic()
    {
        if (numValues < 0)
            numValues = Index.values().length;

        if (names == null)
        {
            names = new HashMap<Index, DataItemType>(numValues);
            names.put(Index.PROBE_AIR_TEMP_1, new DataItemType("Temp aer 1", TYPE_VALUE));
            names.put(Index.PROBE_AIR_TEMP_2, new DataItemType("Temp aer 2", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_TEMP_1, new DataItemType("Temp lemn 1", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_TEMP_2, new DataItemType("Temp lemn 2", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_TEMP_3, new DataItemType("Temp lemn 3", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_TEMP_4, new DataItemType("Temp lemn 4", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_TEMP_5, new DataItemType("Temp lemn 5", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_TEMP_6, new DataItemType("Temp lemn 6", TYPE_VALUE));

            names.put(Index.PROBE_WOOD_HUMID_1, new DataItemType("Umid lemn 1", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_HUMID_2, new DataItemType("Umid lemn 2", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_HUMID_3, new DataItemType("Umid lemn 3", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_HUMID_4, new DataItemType("Umid lemn 4", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_HUMID_5, new DataItemType("Umid lemn 5", TYPE_VALUE));
            names.put(Index.PROBE_WOOD_HUMID_6, new DataItemType("Umid lemn 6", TYPE_VALUE));

            names.put(Index.AVG_AIR_TEMP, new DataItemType("Medie temp aer", TYPE_VALUE));
            names.put(Index.AVG_WOOD_TEMP, new DataItemType("Medie temp lemn", TYPE_VALUE));
            names.put(Index.AVG_WOOD_HUMID, new DataItemType("Medie umid lemn", TYPE_VALUE));

            names.put(Index.CURR_TEMP, new DataItemType("Temp actuala", TYPE_VALUE));
            names.put(Index.CURR_UGL, new DataItemType("UGL actual", TYPE_VALUE));
            names.put(Index.CURR_HUMID, new DataItemType("Umid actuala", TYPE_VALUE));

            names.put(Index.PHASE, new DataItemType("Faza", TYPE_VALUE));
            names.put(Index.WIDTH, new DataItemType("Grosime", TYPE_VALUE));
            names.put(Index.SPECIES, new DataItemType("Specie", TYPE_VALUE));
            names.put(Index.PROGRAM, new DataItemType("Program", TYPE_VALUE));

            names.put(Index.WANTED_TEMP, new DataItemType("Temp dorita", TYPE_VALUE));
            names.put(Index.WANTED_UGL, new DataItemType("UGL dorit", TYPE_VALUE));
            names.put(Index.WANTED_HUMID, new DataItemType("Umid dorita", TYPE_VALUE));

            names.put(Index.RUNNING_FAN, new DataItemType("Vent", TYPE_VALUE));
            names.put(Index.RUNNING_HEAT, new DataItemType("Inc", TYPE_VALUE));
            names.put(Index.RUNNING_MOIST, new DataItemType("Umid", TYPE_VALUE));
            names.put(Index.RUNNING_LIDS, new DataItemType("Clapete", TYPE_VALUE));
        }
    }

    public static int getNumValues()
    {
        setupStatic();
        return numValues;
    }

    public static DataItemType getType(Index i)
    {
        setupStatic();
        return names.get(i);
    }

    public enum Index
    {
        PROBE_AIR_TEMP_1,
        PROBE_AIR_TEMP_2,
        PROBE_WOOD_TEMP_1,
        PROBE_WOOD_TEMP_2,
        PROBE_WOOD_TEMP_3,
        PROBE_WOOD_TEMP_4,
        PROBE_WOOD_TEMP_5,
        PROBE_WOOD_TEMP_6,

        PROBE_WOOD_HUMID_1,
        PROBE_WOOD_HUMID_2,
        PROBE_WOOD_HUMID_3,
        PROBE_WOOD_HUMID_4,
        PROBE_WOOD_HUMID_5,
        PROBE_WOOD_HUMID_6,

        AVG_AIR_TEMP,
        AVG_WOOD_TEMP,
        AVG_WOOD_HUMID,

        CURR_TEMP,
        CURR_UGL,
        CURR_HUMID,

        PHASE,
        WIDTH,
        SPECIES,
        PROGRAM,

        WANTED_TEMP,
        WANTED_UGL,
        WANTED_HUMID,

        RUNNING_FAN,
        RUNNING_HEAT,
        RUNNING_MOIST,
        RUNNING_LIDS
    }
}
